package com.web.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.web.dao.TDictDao;
import com.web.model.TDict;
import com.web.model.TWinNum;
import com.web.service.TDictService;
import com.web.model.PageBean;
import com.web.utils.Pager;

/**
 * 字典 Service实现
 * @author wzy
 * 
 */
@Service
public class TDictServiceImpl implements TDictService{

	//protected Log log = LogFactory.getLog(getClass());
	@Autowired
	private TDictDao dictDao;//注入TDict的dao
	
	
	public int insert(TDict dict){
		return dictDao.insert(dict);
	}
	
	
	public int deleteByPrimaryKey(Long dictId){
		return dictDao.deleteByPrimaryKey(dictId);
	}
	
	
	public int updateByPrimaryKey(TDict dict){
		return dictDao.updateByPrimaryKey(dict);
	}

	
	public TDict selectByPrimaryKey(Long dictId){
		return dictDao.selectByPrimaryKey(dictId);
	}
	
	
	
	public List<TDict> selectList(Map<String,Object> map){
		return dictDao.selectList(map);
	}
	
	
	public PageBean<TDict> selectListByPage(Map<String,Object> map){
		Pager.addPage(map);
		Integer count = dictDao.selectListCount(map);
		List<TDict> list = dictDao.selectList(map);
		PageBean<TDict> pageList = new PageBean<TDict>(list);
		pageList.setTotal(count);
		pageList.setList(list);
		pageList.setPageNum((Integer)map.get("pageNum"));
		pageList.setPageSize((Integer)map.get("pageSize"));
		pageList.setPages(Pager.getPages(count, (Integer)map.get("pageSize")));
		return pageList;
	}
	
	
	public TDict selectByModelSelective(TDict dict){
		return  dictDao.selectByModelSelective(dict);
	}
	
	public void insertList(List<TDict> list){
		dictDao.insertList(list);
	}

	
	public int selectListCount(Map<String, Object> map) {
		return dictDao.selectListCount(map);
	}
	
	
	public List<TDict> doubleLoong(Map<String, Object> map) {
		return dictDao.doubleLoong(map);
	}
}
